//
//  WKEmailInputView.h
//  InputWithEmailDemo
//
//  Created by 李家明 on 12-3-29.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#define noDisableVerticalScrollTag 836913
#define noDisableHorizontalScrollTag 836914

@implementation UIImageView (ForScrollView)

- (void) setAlpha:(float)alpha {
    
    if (self.superview.tag == noDisableVerticalScrollTag) {
        if (alpha == 0 && self.autoresizingMask == UIViewAutoresizingFlexibleLeftMargin) {
            if (self.frame.size.width < 10 && self.frame.size.height > self.frame.size.width) {
                UIScrollView *sc = (UIScrollView*)self.superview;
                if (sc.frame.size.height < sc.contentSize.height) {
                    return;
                }
            }
        }
    }
    
    if (self.superview.tag == noDisableHorizontalScrollTag) {
        if (alpha == 0 && self.autoresizingMask == UIViewAutoresizingFlexibleTopMargin) {
            if (self.frame.size.height < 10 && self.frame.size.height < self.frame.size.width) {
                UIScrollView *sc = (UIScrollView*)self.superview;
                if (sc.frame.size.width < sc.contentSize.width) {
                    return;
                }
            }
        }
    }
    
    [super setAlpha:alpha];
}
@end

@protocol WKEmailInputViewDelegate <NSObject>

@optional
/*
 * 选择后的回调   
 * @prama emailText   完整邮箱字符串
 */
- (void)emailSeleted:(NSString *)emailText;

@end

@interface WKEmailInputView : UIView<UITableViewDelegate,UITableViewDataSource>
{
	UITableView *mTableView;
	NSMutableArray *filteredArray;
	id<WKEmailInputViewDelegate> delegate;
}

@property (nonatomic,assign) id<WKEmailInputViewDelegate> delegate;


/*
 * 重置邮箱
 * @prama text 邮箱前缀
 */
- (void)setEmailInfo:(NSString*)text;
- (void)reSetEmailInfo:(NSString*)text;
- (void)closeEmailInfo;

@end
